<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="/admin/jsp/taglibs.jsp"%>
<html>
	<head>
		<%@ include file="/admin/jsp/header.jsp"%>
		<%@ include file="/framework/jsp/calendar.jsp"%>
		<%@ include file="/framework/jsp/tablesorter.jsp"%>
	</head>
	<body onload="init();">
		<table width="98%" border="0" align="center" cellpadding="3" cellspacing="0">
			<tr>
				<td class="page-title">
					<img src="../images/page_title.gif" alt="title" width="17" height="12" align="absmiddle">
					&nbsp;&nbsp; 系统管理 » 系统日志

				</td>
			</tr>
		</table>
		<br>
		<form id="mainForm" action="/admin/jsp/syslog.do?method=querySyslog" method="post">
			<input type="hidden" name="pageNo" id="pageNo" value="${page.pageNo}" />
			<input type="hidden" name="pageSize" id="pageSize" value="${page.pageSize}" />
			<input type="hidden" name="orderBy" id="orderBy" value="${page.orderBy}" />
			<input type="hidden" name="order" id="order" value="${page.order}" />
			<fieldset style="width: 98%; padding: 10px">
				<legend>
					系统日志查询
				</legend>
				<table width="60%" height="50" border="0" cellpadding="0" cellspacing="0">
					<tr>
						<td>
							操作时间：
						</td>
						<td>


							<input type="text" name="filter_GE_operTime" id="operTimeS" value="${param['filter_GE_operTime']}" size="8" readonly>
							&nbsp;
							<img id="startBtn" style="cursor: hand" src="../images/calendar.gif" />	
							-
							<input type="text"  id="operTimeET" value="${param['filter_LE_operTimeT']}" size="8" readonly >
							<input type="hidden" name="filter_LE_operTime" id="operTimeE" value="${param['filter_LE_operTime']}">
							&nbsp;
							<img id="endBtn" style="cursor: hand" src="../images/calendar.gif" />											
						</td>
					</tr>
					<tr height="5"></tr>
					<tr>
						<td>
							用户名：
						</td>
						<td>
							<input type="text" name="filter_LIKE_operUserName" value="${param['filter_LIKE_operUserName']}" size="12">							
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						
							类型：
					

						


						
							<select name="filter_EQ_operType" id="operType">
								<option value="">--全部--</option>
								<option value="0">登录</option>
								<option value="1">增加</option>
								<option value="2">删除</option>
								<option value="3">修改</option>
								<option value="4">查询</option>
								<option value="5">审核</option>
							</select>
						</td>
					</tr>
					<tr>
						<td align="right" colspan="4">
							<input type="button" class="short-button" value="查  询" onclick="search()"/>
						</td>
					</tr>
				</table>
			</fieldset>	
			
		<br>
	
			<table id="tableList" cellspacing="1" class="tablesorter" width="90%">
				<thead>
					<tr align="center">						
						<th>
							序号
						</th>	
						<th>
							<a href="javascript:sort('operTime','asc')">操作时间</a>
						</th>
						<th>
							<a href="javascript:sort('operType','asc')">类型</a>
						</th>	
						<th>
							描述
						</th>				
						<th>
							<a href="javascript:sort('operUserName','asc')">用户名</a>
						</th>
						<th>
							<a href="javascript:sort('operIp','asc')">操作者IP</a>
						</th>
					</tr>
				</thead>
				<tbody>
					<c:if test="${page.totalCount != '0'}">
						<c:forEach var="syslog" items="${page.result}" varStatus="status" >
							<tr align="center">								
								<td>
									<c:out value="${status.index+1}"/>
								</td>
								<td>
								<fmt:parseDate pattern="yyyyMMddHHmmss" var="parsedDateTime" parseLocale="en_US">
									<c:out value="${syslog.operTime}" />
								</fmt:parseDate>
								<fmt:formatDate value='${parsedDateTime}' pattern="yyyy.MM.dd HH:mm:ss"/>									
								</td>
								<td>
									<c:choose>
										<c:when test="${syslog.operType==0}">登录</c:when>
										<c:when test="${syslog.operType==1}">增加</c:when>
										<c:when test="${syslog.operType==2}">删除</c:when>
										<c:when test="${syslog.operType==3}">修改</c:when>
										<c:when test="${syslog.operType==4}">查询</c:when>
										<c:when test="${syslog.operType==5}">审核</c:when>
									</c:choose>
								</td>			
								<td>
									<c:out value="${syslog.operDesc}" />
								</td>								
								<td>
									<c:out value="${syslog.operUserName}" />
								</td>
								<td>
									<c:out value="${syslog.operIp}" />
								</td>
							</tr>
						</c:forEach>
					</c:if>
					<c:if test="${page.totalCount == '0'}">
						<tr align="center">
							<td colspan="7" align="left">
								暂无符合条件的记录




							</td>
						</tr>
					</c:if>
				</tbody>
			</table>
		</form>
		<div>
			<jsp:include page="/framework/jsp/pager.jsp" flush="true" />
		</div>
	</body>
	<script type="text/javascript">
	var tag=true;
	function init()
	{
		var operType = "${param['filter_EQ_operType']}";
		var operTimeE = "${param['filter_LE_operTime']}";
		var operTimeET=operTimeE.substring(0,8);
		document.getElementById("operType").value = operType;
		document.getElementById("operTimeET").value = operTimeET;
	}
	
	//对时间进行验证


	function testTime(){
		var operTimeS=document.getElementById("operTimeS").value;
		var operTimeET=document.getElementById("operTimeET").value;
		if(operTimeS!=null && operTimeS!="" && operTimeET!=null && operTimeET!=""){
			if(operTimeS - operTimeET<=0){
				document.getElementById("operTimeE").value=operTimeET+"235959";
			}else{
				alert('开始时间不能大于结束时间，请重新选择');	
				document.getElementById("operTimeS").value="";
				document.getElementById("operTimeET").value="";
				tag=false;
				return(false);	
			}
		}
	}
	
	//查询
	function search(){
		testTime();
		if(tag==true){
			$("#order").val("desc");
			$("#orderBy").val("operTime");
			$("#pageNo").val("1");
			$("#pageSize").val("5");
			$("#mainForm").submit();
		}else{
			return(false);
		}
	}
	
	
	Calendar.setup(
	{
      inputField  : "operTimeS",         // ID of the input field
      ifFormat    : "%Y%m%d",    // the date format
      button      : "startBtn"       // ID of the button
	});
	Calendar.setup(
	{
      inputField  : "operTimeET",         // ID of the input field
      ifFormat    : "%Y%m%d",    // the date format
      button      : "endBtn"       // ID of the button
	});
	</script>
</html>